#ifndef __DISTCAPCLIENT_H__
#define __DISTCAPCLIENT_H__

#include "GAframework.hpp"
#include "CaP_Validator.hpp"
#include "Individuo.hpp"
#include "DistCaPProtocol.hpp"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>

using namespace std;

class DistCaPClientException : public EHW_Exception
{
    public:
    DistCaPClientException(char *mess) : EHW_Exception(mess) {};
};

class DistCaPClient
{
	int my_port;
	int my_socket;
	CaP_Validator *myValidator;
	DistCaPProtocol *proto;
	Popolazione *pop;
	GAmodSettings mySettings;

	void mainClientAction() throw(DistCaPClientException);
	int evalPhase(int popSize) throw(DistCaPClientException);

	public:
	DistCaPClient(GAmodSettings &settings) throw(DistCaPClientException);
	~DistCaPClient();

	void startClient() throw(DistCaPClientException);

};

#endif
